<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-courseArrange-edit" th:object="${courseArrange}">
            <input id="courseArrangeId" name="courseArrangeId" th:field="*{courseArrangeId}"  type="hidden">
			<input id="courseId" name="courseId" th:field="*{courseId}"  type="hidden">
			<input id="deptId" name="classId" th:field="*{deptId}"  type="hidden">

			<div class="form-group">	
				<label class="col-sm-3 control-label" >课程名：</label>
				<div class="col-sm-8">
					<label th:text="${courseArrange.course.courseName}"></label>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">选择任课老师</label>
				<div class="col-sm-8">
					<select id="teacher" class="form-control select2-hidden-accessible">
						<option th:each="teacher:${teachers}" th:value="${teacher.userId}" th:text="${teacher.userName}" th:selected="${teacher.flag}" th:disabled="${teacher.status == '1'}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">上课时间：</label>
				<div class="col-sm-8">
					<select id="weekDay">
						<option th:each="weekday:${weekDays}" th:text="${weekday.weekday}" th:value="${weekday.weekday}" th:selected="${weekday.flag}" >第一节</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">上课时间：</label>
				<div class="col-sm-8">
					<select id="startTime">
						<option th:each="startTime:${startTimes}" th:text="${startTime.startTime}" th:value="${startTime.startTime}" th:selected="${startTime.flag}" >第一节</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">上课时间：</label>
				<div class="col-sm-8">
					<select id="endTime">
						<option th:each="endTime:${endTimes}" th:text="${endTime.endTime}" th:value="${endTime.endTime}" th:selected="${endTime.flag}" >第一节</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">上课地点：</label>
				<div class="col-sm-8">
					<input id="place" name="place" th:field="*{place}" class="form-control" type="text">
				</div>
			</div>

		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/courseArrange";
		$("#form-courseArrange-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	var data=$('#form-courseArrange-edit').serializeArray();
	        	var teacherId=$.form.selectSelects("teacher");
				var weekDay=$.form.selectSelects("weekDay");
				var startTime=$.form.selectSelects("startTime");
				var endTime=$.form.selectSelects("endTime");
				data.push({"name":"teacherId","value":teacherId});
				data.push({"name":"weekDay","value":weekDay});
				data.push({"name":"startTime","value":startTime});
				data.push({"name":"endTime","value":endTime});
				console.log("data");
				console.log(data);
				console.log(teacherId);
	            $.operate.save(prefix + "/edit", data);
	        }
	    }
	</script>
</body>
</html>
